home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 8 / QRZ Ham Radio Callsign Database - Volume 8.iso / mac / files / t_sys5 / 92052tar.gz / 920528.tar / nrs.h < prev    next >
C/C++ Source or Header  |  1992-05-28  |  2KB  |  58 lines

  1. /* @(#) $Header: nrs.h,v 1.6 92/05/28 13:50:27 deyke Exp $ */
  2.  
  3. #ifndef _NRS_H
  4. #define _NRS_H
  5.  
  6. #ifndef _GLOBAL_H
  7. #include "global.h"
  8. #endif
  9.  
  10. #ifndef _MBUF_H
  11. #include "mbuf.h"
  12. #endif
  13.  
  14. #ifndef _IFACE_H
  15. #include "iface.h"
  16. #endif
  17.  
  18. #define NRS_MAX 16              /* Maximum number of Nrs channels */
  19.  
  20. /* SLIP definitions */
  21. #define NRS_ALLOC       512     /* Receiver allocation increment */
  22.  
  23. #define STX     0x02            /* frame start */
  24. #define ETX 0x03                /* frame end */
  25. #define DLE     0x10            /* data link escape */
  26. #define NUL 0x0                 /* null character */
  27.  
  28. /* packet unstuffing state machine */
  29. #define NRS_INTER       0               /* in between packets */
  30. #define NRS_INPACK      1               /* we've seen STX, and are in a the packet */
  31. #define NRS_ESCAPE      2               /* we've seen a DLE while in NRS_INPACK */
  32. #define NRS_CSUM        3               /* we've seen an ETX, and are waiting for the checksum */
  33.  
  34. /* net/rom serial protocol control structure */
  35. struct nrs {
  36.     char state;             /* Receiver State control flag */
  37.     unsigned char csum;     /* Accumulating checksum */
  38.     struct mbuf *rbp;       /* Head of mbuf chain being filled */
  39.     struct mbuf *rbp1;      /* Pointer to mbuf currently being written */
  40.     char *rcp;              /* Write pointer */
  41.     int16 rcnt;             /* Length of mbuf chain */
  42.     struct mbuf *tbp;       /* Transmit mbuf being sent */
  43.     long errors;            /* Checksum errors detected */
  44.     long packets ;          /* Number of packets received successfully */
  45.     struct iface *iface ;   /* Associated interface structure */
  46.     int (*send) __ARGS((int,struct mbuf *));/* Routine to send mbufs */
  47.     int (*get) __ARGS((int,char *,int));/* Routine to fetch input chars */
  48. };
  49.  
  50. extern struct nrs Nrs[];
  51. /* In nrs.c: */
  52. int nrs_free __ARGS((struct iface *ifp));
  53. int nrs_init __ARGS((struct iface *ifp,int vj));
  54. int nrs_raw __ARGS((struct iface *iface,struct mbuf *bp));
  55. void nrs_recv __ARGS((struct iface *iface));
  56.  
  57. #endif  /* _NRS_H */
  58.